package com.demo.shiro.factory;

import java.util.LinkedHashMap;

/**
 * 从数据库初始化资源和权限
 */
public class FilterChainDefinitionMapBulider {
    public LinkedHashMap<String,String> filterChainDefinitionMap(){
        LinkedHashMap<String, String> hashMap = new LinkedHashMap<>();
        //按顺序添加
        hashMap.put("/login.jsp","anon");
        hashMap.put("/shiroLogin","anon");
        hashMap.put("/logout","logout");
        hashMap.put("/admin.jsp","authc,roles[admin]");
        hashMap.put("/user.jsp","authc,roles[user]");
        hashMap.put("/list.jsp","user");//认证过或“记住我”都可访问list.jsp
        hashMap.put("/**","authc");
        return hashMap;
    }
}
